import request from '@/utils/request';
import { AxiosPromise } from 'axios';

/**
 * 查询生产计划列表
 * @param query
 * @returns {*}
 */

export const list = (query) => {
  return request({
    url: '/biz-device/device/production/plan/list',
    method: 'get',
    params: query
  });
};

/**
 * 获取生产计划详细信息
 * @param id
 */
export const info = (id: string | number) => {
  return request({
    url: '/biz-device/device/production/plan/' + id,
    method: 'get'
  });
};

/**
 * 启用生产计划
 * @param id
 * @returns
 */
export const open = (id) => {
  return request({
    url: '/biz-device/device/production/plan/open/' + id,
    method: 'put'
  });
};

/**
 * 展示生产计划
 * @param id
 * @returns
 */
export const shown = (id) => {
  return request({
    url: '/biz-device/device/production/plan/shown/' + id,
    method: 'put'
  });
};

/**
 * 关闭生产计划
 * @param id
 * @returns
 */
export const close = (id) => {
  return request({
    url: '/biz-device/device/production/plan/close/' + id,
    method: 'put'
  });
};

/**
 * 新增
 * @param data
 */
export const add = (data) => {
  return request({
    url: '/biz-device/device/production/plan',
    method: 'post',
    data: data
  });
};

/**
 * 编辑
 * @param data
 */
export const update = (data) => {
  return request({
    url: '/biz-device/device/production/plan',
    method: 'put',
    data: data
  });
};

/**
 * 删除
 * @param ids
 */
export const del = (ids: Array<string | number>) => {
  return request({
    url: '/biz-device/device/production/plan/' + ids,
    method: 'delete'
  });
};
